package org.example.platform.design.abstractfactory;

import org.example.platform.design.abstractfactory.factorymehod2.factorymehod.FactoryInterface;
import org.example.platform.design.abstractfactory.factorymehod2.factorymehod.dept.Dept;
import org.example.platform.design.abstractfactory.factorymehod2.factorymehod.dept.DeptSQLInterface;
import org.example.platform.design.abstractfactory.factorymehod2.factorymehod.user.SQLInterface;
import org.example.platform.design.abstractfactory.factorymehod2.factorymehod.SqlServer;

/**
 * 抽象工厂
 */
public class Test {

    public static void main(String[] args) {
        User user = new User();
        UserService userService = new UserService();
        userService.add(user);
        userService.getByName(user);

        // 版本2
        FactoryInterface factory = new SqlServer();
        SQLInterface user2 = factory.create();
        user2.getByName(user);


        Dept dept = new Dept();
        // 版本2
        FactoryInterface factory2 = new SqlServer();
        DeptSQLInterface deptSQLInterface = factory2.createDept();
        deptSQLInterface.getByName(dept);


    }
}
